import {inject, observer} from "mobx-react";
import {WeaTableNew} from 'comsMobx';
import {WeaTools, WeaTop, WeaRightMenu} from 'ecCom';
import {Button} from 'antd';
const WeaTable = WeaTableNew.WeaTable;

@inject("portalStore")
@observer
class Portal extends React.Component {
  constructor(props) {
    super(props);
  }
  componentDidMount() {
    let {eid, tabId} = this.props.params;
    let {portalStore} = this.props;
    portalStore.getOutterDataMore(eid, tabId);
    portalStore.getTitle(eid, tabId);
  }
  render() {
    let {portalStore} = this.props;
    let {tableStore, title} = portalStore;
    return (
      <div style={{width: '100%', height: '100%'}}>
        <WeaRightMenu ecId={`${this && this.props && this.props.ecId || ''}_WeaRightMenu@x2p05r`} datas={getDropList()} onClick={this.onDropMenuClick}>
          <WeaTop ecId={`${this && this.props && this.props.ecId || ''}_WeaTop@hd0xsy`}
            title={title}
            icon={<i className='icon-coms-integration' />}
            iconBgcolor='#1A57A0'
            showDropIcon={true}
            dropMenuDatas={getDropList()}
            onDropMenuClick={this.onDropMenuClick}
          >
            <div className="wea-inte-portal">
              <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@0sbmvy`} comsWeaTableStore={tableStore}/>
            </div>
          </WeaTop>
        </WeaRightMenu>
      </div>
    );
  }
  
  onDropMenuClick = (key) => {
    if ('setCol' == key) {
      this.setCol();
    }
  }
  
  setCol = () => {
    const {portalStore} = this.props;
    const {tableStore} = portalStore;
    tableStore.setColSetVisible(true);
    tableStore.tableColSet(true);
  }
}
const getDropList = () => {
  let dropMenuList = [
    {
      key: 'setCol',
      icon: <span className="icon-coms-Custom"></span>,
      content: '显示列定制'
    }
  ];
  return dropMenuList;
}

export default Portal;